﻿@page "/Warehouses"
@using Microsoft.AspNetCore.Authorization
@using maERP.SharedUI.Models.Warehouse

@attribute [Authorize]

<PageTitle>Lager</PageTitle>

<MudStack Row="true" Class="mb-8">
    <MudText Typo="Typo.h4">Lager</MudText>
    <MudSpacer />
    <MudIconButton Icon="@Icons.Material.Filled.Add" Color="Color.Primary" Href="/Warehouses/Add" />
</MudStack>

<MudDataGrid T="WarehouseVM" SortMode="SortMode.Single" Class="mb-8" ServerData="LoadGridData">
    <ToolBarContent>
        @*<MudText Typo="Typo.h6">Periodic Elements</MudText>*@
        <MudSpacer />
        <MudTextField @bind-Value="_searchString" TextChanged="this.Search" Placeholder="Suche" Adornment="Adornment.Start" Immediate="true" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
    </ToolBarContent>
    <Columns>
        <PropertyColumn Property="x => x.Name" Title="Name" />
        <TemplateColumn CellClass="d-flex justify-end">
            <CellTemplate>
                <MudIconButton Icon="@Icons.Material.Outlined.FindInPage" Href="@($"/Warehouses/{context.Item.Id}")" Size="@Size.Small" Color="@Color.Primary"></MudIconButton>
                <MudIconButton Icon="@Icons.Material.Outlined.Edit" Href="@($"/Warehouses/{context.Item.Id}/Edit")" Size="@Size.Small" Color="@Color.Primary"></MudIconButton>
            </CellTemplate>
        </TemplateColumn>
    </Columns>
    <PagerContent>
        <MudDataGridPager T="WarehouseVM" />
    </PagerContent>
</MudDataGrid>